
/* <<< COPYRIGHT START >>>
 * Copyright 2006-Present OxygenSoftwareLibrary.com
 * Licensed under the GNU Lesser General Public License.
 * http://www.gnu.org/licenses/lgpl.html
 * 
 * @author: Ugorji Dick-Nwoke
 * <<< COPYRIGHT END >>>
 */


package oxygen.markup.macros;

import java.io.Writer;

import oxygen.markup.MarkupMacroParameters;
import oxygen.markup.MarkupRenderContext;
import oxygen.web.WebInteractionContext;
import oxygen.web.WebLocal;

/**
 * Includes the current username
 * Usage: [[username]]
 * @author ugorji
 */
public class Username extends GenericMarkupMacro {

  public void doExecute(Writer writer, MarkupRenderContext rc, MarkupMacroParameters params) throws Exception {
    WebInteractionContext req = WebLocal.getWebInteractionContext();
    if(req != null) {
      writer.write(req.getUserName());
    }
  }
  
}

